<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>构造函数</title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		//工厂模式
//		找一辆车 出厂 （合格证/简易零售价/说明书）
	 	function Car(name,time,copy,price,title){
		 	var Car=new Object();
		 	Car.name=name;
		 	Car.time=time;
		 	Car.copy=copy;
		 	Car.price=price;
		 	Car.title=title;
		 	Car.obj=function(){
		 		alert("这是一辆"+this.name+",出厂日期是"+this.time+",出厂质检"+this.copy+",售价是"+this.price+"万人民币，性能是"+this.title)
		 	}
		 	return Car;
		 }
		var car=Car("宝马","2017-7-25","合格","6556","底盘低，安全舒适")
		 car.obj()
		 
		 
//		 构造模式
//		 小明 今年18岁 性别男 有男朋友 男朋友会说话 说什么自己定
		function Person(name,age,sex,a,b,c){
			this.name=name;
			this.age=age;
			this.sex=sex;
			this.a=a;
			this.b=b;
			this.c=c;
            alert("有一个人叫"+this.name+",今年"+this.age+"岁,"+"性别为，"+this.sex+this.a+","+this.b+this.c)
		}
		var person=new Person("小明",18,"男,","有男朋友","男朋友会说话，","说我不是男的")
	</script>
</html>
